﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
//using System.Data.Entity.ModelConfiguration.Conventions.Edm.Db;
using System.Data.Entity.ModelConfiguration;
//using System.Data.Entity.ModelConfiguration.Conventions.Configuration;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace FILSTARTUPS_CMS.Models
{
    public class FilStartUpsEntities : DbContext
    {

        public FilStartUpsEntities()
            : base("FILSTARTUPS_CMS")
        {
            System.Data.Entity.Database.SetInitializer<FilStartUpsEntities>(null);
        }
   

        public DbSet<Post> Post { get; set; }
        public DbSet<Category> Categories { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Pages> Pages { get; set; }
        public DbSet<Event> Events { get; set; }
        public DbSet<Session> Sessions { get; set; }
        public DbSet<RoutingType> RoutingType { get; set; }
        public DbSet<Forum> Forums { get; set; }

     
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

            modelBuilder.Entity<Category>().ToTable("dbo.Category");
            modelBuilder.Entity<Category>().Property(c => c.catidPK);

            modelBuilder.Entity<Event>().ToTable("dbo.Event");
            modelBuilder.Entity<Event>().Property(e => e.eventidPK);
            
            modelBuilder.Entity<Post>().ToTable("dbo.Post");
            modelBuilder.Entity<Post>().Property(p => p.postidPK);

            modelBuilder.Entity<User>().ToTable("dbo.User");
            modelBuilder.Entity<User>().Property(u => u.useridPK);

            modelBuilder.Entity<Session>().ToTable("dbo.Session");
            modelBuilder.Entity<Session>().Property(s => s.sessionidPK);

            modelBuilder.Entity<Role>().ToTable("dbo.Role");
            modelBuilder.Entity<Role>().Property(r => r.roleidPK);

            modelBuilder.Entity<Pages>().ToTable("dbo.Page");
            modelBuilder.Entity<Pages>().Property(p => p.pageidPK);

            modelBuilder.Entity<Forum>().ToTable("dbo.Forum");
            modelBuilder.Entity<Forum>().Property(f => f.forumidPK);

            modelBuilder.Entity<RoutingType>().ToTable("dbo.RoutingType");
            modelBuilder.Entity<RoutingType>().Property(r => r.routingidPK);
        }
    }
}